<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- 给div起一个引用的名字，叫做reference -->
        <div ref="reference" @click="handle">hello</div>
    </div>

    <script>
        var vm = new Vue({
            el: "#app",
            methods: {
                // 希望div被点击的时候，div里面的内容被打印出来
                handle: function () {
                    // this.$refs.reference就能拿到div的DOM节点，之后就能拿到他的innerHTML
                    alert(this.$refs.reference.innerHTML);
                }
            },
        })
    </script>
</body>

</html>